<?php
include_once('common/header.php');
if($AppUI->id < 0 || !isset($_SERVER['HTTP_REFERER'])) {
	Vfriend_Function::redirect(HOST_VFRIEND);
}
$objRequest = $this->_request;
$strKeyword = trim($objRequest->getParam('val', ''));
if (strlen($strKeyword) > 2) {
	$objNews 	= new News();
	$arrResult 	= $objNews->getSmartSearch($strKeyword);
	$this->view->arrResult = $arrResult;
	$objView 	= Zend_Registry::get('objView');
	$strData	= $objView->fetch('ajax/smart-search-news.tpl');
	$arrJson 	= array('data'=>$strData);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
}
exit();
?>